package com.example.musicplayer;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //String startAudioService="com.studio.android.START_AUDIO_SERVICE";
        Button play=(Button)findViewById(R.id.play);
        play.setOnClickListener(startIt);
        Button stop=(Button)findViewById(R.id.stop);
        stop.setOnClickListener(stopIt);
    }
    private View.OnClickListener startIt=new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startService(new Intent("com.studio.android.START_AUDIO_SERVICE"));
        }
    };
    private View.OnClickListener stopIt=new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            stopService(new Intent("com.studio.android.START_AUDIO_SERVICE"));
            finish();
        }
    };
}
